Biostat 200B Homework 8

Due Mar 15 @ 11:59PM

Author

Ziheng Zhang_606300061

Question 1

What differences do you see in the relationships between the SS for A, B and A\(*\)B for balanced versus unbalanced data?

Answer:

Type III SS are SSA, SSB and SSAB are the sums of squares used for testing the null hypotheses that there is no effect of factor A, factor B, or no interaction. These SS are for comparing models with and without that factor (or the interaction).
Type I SS are sequential; they test for an incremental effect when the term is added to a model including the terms above it.

The results for balanced data are as follows:

In balanced data, where the cell sizes are equal, the Type I and Type III SS are identical. This is because the factors are uncorrelated predictors. So we can estimate the factor effects independently of one another and estimating the marginal effects yields the same results as estimating the partial effects.

The results for unbalanced data are as follows:

In unbalanced data, where the cell sizes are unequal, the Type I and Type III SS are different. This is because the factors are correlated predictors. Tests for effects are not independent.

Question 2

For the balanced and unbalanced data, provide a 2 x 3 table of cell means. By hand, compute the (unadjusted) factor means and least square (adjusted) means for each data set.

Answer:

Question 3

Write code and estimate the contrast for comparing the difference between auditory and visual when elapse time is 10 sec to the difference between auditory and visual when elapse time is 15 sec.

Answer:

The SAS codes are as follows:

The constrast estimate result is as follows:

The contrast estimate is \(0.00057408\), which is close to 0. The F-statistic is \(1.98\), and the p-value is \(0.1843\). The p-value is greater than 0.05, so we fail to reject the null hypothesis that the difference between auditory and visual when elapse time is 10 sec is equal to the difference between auditory and visual when elapse time is 15 sec and conclude that there is no significant evidence that the difference between auditory and visual when elapse time is 10 sec is not equal to the difference between auditory and visual when elapse time is 15 sec.

Question 4

Answer:

a

The SAS codes are as follows:

The results are as follows:

Let poison = A and treatment = B.
From the F-statistic of A*B, 1.22, and its p-value, \(0.3189<0.05\), we can conclude that the interaction is not significant and then we drop the interaction term from the model. The final model and two-way ANOVA results are as follows:

b

The SAS codes are as follows:

The results are as follows:

From the plots above, it seems that \(E(\epsilon_{i}) = 0\) for all \(\textit{i}\) and the residual plot does not show any special pattern. And the error variance are roughly constant across all observations. Also, from QQ plot, all points roughly follow a straight line. So the model assumptions are reasonably met.

c

The interaction plot is as follows:

d

The SAS codes are as follows:

The results are as follows:

The estimate for \(\alpha_{1}-\alpha_{2}\) is \(0.1867\) and we use back-transform to get the estimate for the ratio of geometric means (or medians) of poison at level 1 and level 2. It is \(e^{0.1867} = 1.205\), which means the median survival time in units of 10 hour is about \(20.5\%\) longer for poison at level 1 compared to poison at level 2. The \(95\%\) confidence interval for the difference between the means of poison at level 1 and level 2 (\(\alpha_{1}-\alpha_{2}\)) for the log-transformed data is \((0.018, 0.355)\). Since we did log transformation to the response variable, we need to back-transform the confidence interval. The back-transformed \(95\%\) confidence interval is \((e^{0.018}, e^{0.355}) = (1.018, 1.426)\). This is the \(95\%\) confidence interval for the ratio of geometric means (or medians) of poison at level 1 and level 2.

e

The SAS codes are as follows:

The results are as follows:

So the point estimate for \(\beta_{1}-\beta_{2}-\beta_{3}+\beta_{4}\) is \(-0.3943\), standard error is \(0.1363\), the t-statistic is \(-2.89\) and the p-value is \(0.006<0.05\). So we reject the null hypothesis and conclude that there is significant evidence that the difference in means (on the log-transformed scale) for treatment 1 and 2 is not equal to the difference in means for treatment 3 and 4.

The \(95\%\) confidence interval for \(\beta_{1}-\beta_{2}-\beta_{3}+\beta_{4}\) is \[\begin{align*} &(-0.3943-t_{0.975, 42}*0.1363, -0.3943+t_{0.975, 42}*0.1363)\\ &= (-0.3943-2.018*0.1363, -0.3943+2.018*0.1363)\\ &= (-0.669, -0.119) \end{align*}\] where degree of freedom is \(N-a-b+1 = 48-4-3+1 = 42\).

Question 5

Answer:

The table of means can be interpreted as follows:

So the estimates of row means are \(\bar{Y}_{1..} = \frac{23}{3}\) and \(\bar{Y}_{2..} = \frac{37}{3}\). The estimates of column means are \(\bar{Y}_{.1.} = 15\), \(\bar{Y}_{.2.} = 9\) and \(\bar{Y}_{.3.} = 6\). The estimate of the pooled mean is \(\bar{Y_{...}}=10\).

So the estimates of these quantities are as follows:

Parameter Estimate Estimate Value
\(\mu\) \(\bar{Y}_{...}\) \(\phantom{-}10\)
\(\alpha_{1}\) \(\bar{Y}_{1..}-\bar{Y}_{...}\) \(-\frac{7}{3}\)
\(\alpha_{2}\) \(\bar{Y}_{2..}-\bar{Y}_{...}\) \(\phantom{-}\frac{7}{3}\)
\(\beta_{1}\) \(\bar{Y}_{.1.}-\bar{Y}_{...}\) \(\phantom{-}5\)
\(\beta_{2}\) \(\bar{Y}_{.2.}-\bar{Y}_{...}\) \(-1\)
\(\beta_{3}\) \(\bar{Y}_{.3.}-\bar{Y}_{...}\) \(-4\)
\((\alpha\beta)_{11}\) \(\bar{Y}_{11.}-(\bar{Y}_{1..}+\bar{Y}_{.1.}-\bar{Y}_{...})\) \(\phantom{-}\frac{1}{3}\)
\((\alpha\beta)_{12}\) \(\bar{Y}_{12.}-(\bar{Y}_{1..}+\bar{Y}_{.2.}-\bar{Y}_{...})\) \(-\frac{2}{3}\)
\((\alpha\beta)_{13}\) \(\bar{Y}_{13.}-(\bar{Y}_{1..}+\bar{Y}_{.3.}-\bar{Y}_{...})\) \(\phantom{-}\frac{1}{3}\)
\((\alpha\beta)_{21}\) \(\bar{Y}_{21.}-(\bar{Y}_{2..}+\bar{Y}_{.1.}-\bar{Y}_{...})\) \(-\frac{1}{3}\)
\((\alpha\beta)_{22}\) \(\bar{Y}_{22.}-(\bar{Y}_{2..}+\bar{Y}_{.2.}-\bar{Y}_{...})\) \(\phantom{-}\frac{2}{3}\)
\((\alpha\beta)_{23}\) \(\bar{Y}_{23.}-(\bar{Y}_{2..}+\bar{Y}_{.3.}-\bar{Y}_{...})\) \(-\frac{1}{3}\)